home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / shells / scsh-0.4 / scsh-0 / scsh-0.4.2 / scsh / scsh-package.scm < prev    next >
Text File  |  1995-10-31  |  8KB  |  295 lines

  1. ;;; The packages that scsh uses/defines.
  2. ;;; Copyright (c) 1994 by Olin Shivers.
  3.  
  4. ;;; Note: field-reader package (fr.scm) and here docs use READ-LINE.
  5. ;;; It is defined in rdelim.scm.
  6.  
  7. ;;; You link up a scsh package by defining a package named OS-DEPENDENT
  8. ;;; that satisfies the interfaces for packages
  9. ;;;     buffered-io-flags
  10. ;;;     posix-fdflags 
  11. ;;;     posix-errno
  12. ;;;     posix-signals
  13. ;;; Anything else it provides should be specified in an interface called
  14. ;;; os-extras-interface. See the scsh structure below.
  15. ;;; Then the scsh structure can be instantiated.
  16. ;;;
  17. ;;; The architecture directories, like next/ and irix/ and so forth,
  18. ;;; provide packages that can serve as the os-dependent package. E.g.,
  19. ;;; the next-defs package, defined in next/packages.
  20. ;;;
  21. ;;; This whole mechanism would be better solved with a functor.
  22. ;;;     -Olin
  23.  
  24.  
  25. (define-structure error-package (export error warn)
  26.   (open signals))
  27.  
  28.  
  29. (define-structure scsh-utilities scsh-utilities-interface
  30.   (open bitwise error-package scheme)
  31.   (files utilities))
  32.  
  33.  
  34. ;;; This guy goes into the FOR-SYNTAX part of scsh's syntax exports.
  35. (define-structure scsh-syntax-helpers
  36.   (export transcribe-extended-process-form)
  37.   (open receiving    ; receive
  38.     error-package
  39.     syntactic    ; generated?
  40.     scsh-utilities    ; check-arg, optional-arg
  41.     scheme
  42.     )
  43.   (files syntax-helpers))
  44.  
  45.  
  46. ;;; The bufpol/{block, line, none} values
  47. (define-structure buffered-io-flags buffered-io-flags-interface
  48.   (open defenum-package scheme)
  49.   (files (machine bufpol)))
  50.  
  51. (define-structures ((scsh-regexp-package scsh-regexp-interface)
  52.             (scsh-regexp-internals (export %filter-C-strings!)))
  53.   (open    defrec-package
  54.     scsh-utilities
  55.     define-foreign-syntax
  56.     receiving
  57.     error-package
  58.     scheme)
  59.   (files re))
  60.  
  61.  
  62. (define-structure char-set-package char-set-interface  
  63.   (open error-package ascii scheme)
  64.   (files char-set))
  65.  
  66.  
  67. (define-structure field-reader-package scsh-field-reader-interface
  68.   (open receiving        ; receive
  69.     char-set-package
  70.     scsh-utilities
  71.     error-package        ; error
  72.     scsh-level-0        ; regexes and delimited readers
  73.     scheme
  74.     )
  75.   (files fr))
  76.  
  77.  
  78. (define-structures
  79.   ((awk-expander-package (export expand-awk))
  80.    (awk-support-package (export next-range next-:range
  81.                 next-range: next-:range:)))
  82.   (open receiving        ; receive
  83.     scsh-utilities    
  84.     error-package        ; error
  85.     char-set-package
  86.     scheme
  87.     )
  88.   (files awk))
  89.      
  90.  
  91. (define-structure awk-package awk-interface
  92.   (open awk-support-package scsh-regexp-package receiving scheme)
  93.   (for-syntax (open awk-expander-package scheme))
  94.   (begin (define-syntax awk expand-awk)))
  95.  
  96.  
  97. (define-structures ((tty-flags tty-flags-interface)
  98.             (scsh-internal-tty-flags scsh-internal-tty-flags-interface))
  99.   (open scheme ascii bitwise)
  100.   (files (machine tty-consts)))
  101.  
  102.  
  103. (define-structure scsh-version scsh-version-interface
  104.   (open scheme)
  105.   (files scsh-version))
  106.  
  107. ;;; The scsh-level-0 package is for implementation convenience.
  108. ;;; The scsh startup and top-level modules need access to scsh
  109. ;;; procedures, but they export procedures that are themselves
  110. ;;; part of scsh. So scsh-level-0 is the core scsh stuff, which is
  111. ;;; imported by these two modules. These modules all collectively
  112. ;;; export the whole scsh enchilada.
  113.  
  114. (define-structures
  115.   ((scsh-level-0-internals (export set-command-line-args!
  116.                    init-scsh-hindbrain init-scsh-vars))
  117.    (scsh-level-0
  118.     (compound-interface posix-fdflags-interface
  119.             posix-errno-interface
  120.             posix-signals-interface
  121.             sockets-network-interface ; Standard Network Interface
  122.             os-extras-interface ; Extra stuff from OS.
  123.             scsh-delimited-readers-interface
  124.             scsh-errors-interface
  125.             scsh-io-interface
  126.             scsh-file-interface
  127.             scsh-process-interface
  128.             scsh-process-state-interface
  129.             scsh-user/group-db-interface
  130.             scsh-command-line-interface
  131.             scsh-signals-interface
  132.             scsh-environment-interface
  133.             scsh-home-interface
  134.             scsh-string-interface
  135.             scsh-file-names-interface
  136.             scsh-misc-interface
  137.             scsh-high-level-process-interface
  138.             scsh-time-interface ; new in 0.2
  139.             scsh-sockets-interface ; new in 0.3
  140.             tty-interface ; new in 0.4
  141.             scsh-version-interface
  142.             char-set-interface
  143.             ;; This stuff would probably be better off kept
  144.             ;; in separate modules, but we'll toss it in for now.
  145.             (interface-of ascii) ; char<->ascii
  146.             string-ports-interface
  147.             )))
  148.   (for-syntax (open scsh-syntax-helpers scheme))
  149.   (open externals
  150.     structure-refs
  151.     cig-aux
  152.     receiving
  153.     defrec-package
  154.     define-foreign-syntax
  155.     formats
  156.     os-dependent        ; OS dependent stuff
  157.     buffered-io-flags    ; stdio dependent
  158.     ascii
  159.     records
  160.     extended-ports
  161.     ports
  162.     build
  163.     bigbit
  164.     bitwise
  165.     signals
  166.     conditions
  167.     scsh-utilities
  168.     handle
  169.     fluids
  170.     weak
  171.  
  172.     scsh-regexp-package
  173.     scsh-regexp-internals
  174.     char-set-package
  175.     scsh-version
  176.     tty-flags
  177.     scsh-internal-tty-flags    ; Not exported
  178.     
  179.     scheme
  180.     )
  181.  
  182.   (access command-processor
  183.       escapes
  184.       ports        ; S48's force-output
  185.       formats
  186.       records    ; I don't think this is necessary. !!!
  187.       scheme)    ; For accessing the normal I/O operators.
  188.  
  189.   (begin (define set-batch-mode?!
  190.        (structure-ref command-processor set-batch-mode?!))
  191.      (define with-continuation (structure-ref escapes with-continuation)))
  192.  
  193.   (files syntax
  194.      syscalls
  195.      select
  196.      fname
  197.      stringcoll
  198.      scsh-condition
  199.      rw
  200.      newports
  201.      fdports
  202.      procobj        ; New in release 0.4.
  203.      (machine waitcodes)    ; OS dependent code.
  204.      filesys
  205.      fileinfo
  206.      glob
  207.      filemtch
  208.      rdelim
  209.      time            ; New in release 0.2.
  210.      (machine time_dep)
  211.      network        ; New in release 0.3.
  212.      endian            ; New in release 0.4.
  213.      flock            ; New in release 0.4.
  214.      tty            ; New in release 0.4.
  215.      pty            ; New in release 0.4.
  216.      scsh
  217.      ))
  218.  
  219. (define-structure defrec-package (export (define-record :syntax))
  220.   (open records scheme)
  221.   (for-syntax (open scheme error-package receiving))
  222.   (files defrec))
  223.  
  224. (define-structure defenum-package (export (define-enum-constant :syntax))
  225.   (open scheme)
  226.   (files enumconst))
  227.  
  228. ;;; This code opens so many modules of gruesome, low-level S48 internals 
  229. ;;; that these two modules are segregated into separate packages, each
  230. ;;; exporting just two definitions.
  231.  
  232. (define-structure scsh-startup-package (export dump-scsh-program dump-scsh)
  233.   (open scsh-level-0-internals    ; init-scsh-* set-command-line-args!
  234.     scsh-level-0        ; error-output-port command-line-arguments
  235.     scsh-top-package    ; parse-switches-and-execute
  236.     handle            ; with-handler
  237.     command-processor    ; user-context
  238.     write-images        ; write-image
  239.     build-internals        ; simple-condition-handler
  240.     low-level        ; flush-the-symbol-table!
  241.     command-processor    ; command-output
  242.     filenames        ; translate
  243.     scheme-level-2-internal    ; usual-resumer
  244.     scheme)
  245.   (files startup))
  246.  
  247. (define-structure scsh-top-package (export parse-switches-and-execute repl)
  248.   (open command-processor
  249.     ensures-loaded
  250.     environments
  251.     error-package
  252.     evaluation
  253.     extended-ports
  254.     interfaces
  255.     interrupts
  256.     package-commands-internal
  257.     package-mutation
  258.     packages
  259.     receiving
  260.     scsh-version
  261.     scsh-level-0        ; with-current-input-port error-output-port
  262.                 ; with-current-output-port exit
  263.     scsh-level-0-internals    ; set-command-line-args! init-scsh-vars
  264.     scheme)
  265.   (files top meta-arg))
  266.  
  267.  
  268. (define-structure scsh
  269.   (compound-interface (interface-of scsh-level-0)
  270.               (interface-of scsh-startup-package)
  271.               scsh-field-reader-interface     ; new in 0.3
  272. ;              scsh-dbm-interface
  273.               (export repl)
  274.               awk-interface)
  275.  
  276.   (open structure-refs
  277.     scsh-level-0
  278.     scsh-level-0-internals
  279.     scsh-startup-package
  280. ;    dbm
  281.     awk-package
  282.     field-reader-package
  283.     scheme)
  284.  
  285.   (access scsh-top-package)
  286.   (begin (define repl (structure-ref scsh-top-package repl))))
  287.  
  288. (define-structure scsh-here-string-hax (export)
  289.   (open reading
  290.     receiving
  291.     scsh        ; Just need the delimited readers.
  292.     features    ; make-immutable!
  293.     scheme)
  294.   (files here))
  295.